package cn.edu.sptc.sms_chensiyi.service.impl;

import cn.edu.sptc.sms_chensiyi.dao.MajorMapper;
import cn.edu.sptc.sms_chensiyi.entity.Major;
import cn.edu.sptc.sms_chensiyi.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
//实现包
//服务层
@Service
public class MajorServiceImpl implements MajorService {
    //调用数据访问层dao
    @Autowired
    private MajorMapper majorMapper;

    @Override
    public boolean insertMajor(Major major) {
        if(majorMapper.insert(major)>0){
                return true;
        }
        return false;
    }

    @Override
    public boolean updateMajor(Major major) {
        if (majorMapper.update(major)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteMAjor(Long id) {
        if (majorMapper.delete(id)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Major> queryByALl() {
         return majorMapper.selectALL();
    }

    @Override
    public Major queryByID(Long id) {
        return majorMapper.selectByID(id);
    }
}
